package com.tebiecloud.mpweixin.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tebiecloud.mpweixin.client.model.entity.MpminiUser;
import com.tebiecloud.mpweixin.server.mapper.MpminiUserMapper;
import com.tebiecloud.mpweixin.server.service.MpminiUserService;
import com.tebiecloud.common.mybatis.base.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 小程序用户 服务实现类
 * @author tebie
 * @date 2019-09-24
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MpminiUserServiceImpl extends BaseServiceImpl<MpminiUserMapper, MpminiUser> implements MpminiUserService {

    @Override
    public MpminiUser getMpminiUser(String openid) {
        QueryWrapper<MpminiUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("open_id", openid);
        queryWrapper.orderByDesc("ct");
        return super.getOne(queryWrapper, false);
    }

}
